/**
 * Created by 李海强1 on 2016/10/13.
 */

Ext.define('UDZ.model.Model_Regist', {
    extend: 'Ext.data.Model',

    config: {
        fields: [
            {name: 'userName',  type: 'string'},
            {name: 'userPassword',   type: 'string'},
            {name: 'userPhone',   type: 'string'}
        ],
        validations: [
            {type: 'presence',  field: 'userName',message:'用户名不能为空'},//从上到下验证
            {type: 'length',    field: 'userName',  min: 6,message:'用户名长度大于6位'},
            {type: 'format',    field: 'userName', matcher: /^[A-Za-z0-9_]+$/,message:'用户名必须为数字字母下划线'},
            {type: 'presence',  field: 'userPassword',message:'密码不能为空'},//从上到下验证
            {type: 'length',    field: 'userPassword', min: 6,max:16,message:'密码长度6到16位'},
            {type: 'format',    field: 'userPassword', matcher: /^[A-Za-z0-9_#@*&%]+$/,message:'密码格式不正确'},
            {type: 'presence',  field: 'userPhone',message:'请填写手机号'},//从上到下验证
            {type: 'format',    field: 'userPhone', matcher: /^1[34578]{1}\d{9}$/,message:'手机号格式不正确'},
        ]
    }
    //    /* changeName:function () {
//         var oldName=this.get('userName');
//             newName=oldName+"The Barbarian";
//         this.set('userName',newName);
//     }*/
});
